Query2Tree v.2. Convert any query to tree. By P.Tsiros

added ordering, pagination, filter

 

this is the place for the tree.  

Actually every table or query is a tree (not well formed and in good shape, but a tree ... ok grass).

this script uses mysql, php, ajax and javascript

for the purposes of demo

there is a table with name "countries"

his fields are

  1. continent
  2. country
  3. capital
  4. area
  5. population

the data was taken from http://download.geonames.org/export/ (click the link download server)

click on the examples

  1. select continent,country,concat("area: ",area," population: ",population) from countries
  2. select left(country,1) as lex,country from countries
  3. select continent,left(country,1) as lex,concat(country," (",capital,")") from countries
  4. select concat(conti.continent," (",FORMAT(sum_pop,0),")") as cont_pop,country,FORMAT(country.population,0) from (select continent,sum(population) as sum_pop from countries group by continent) as conti left join (select continent,country,population from countries) as country on conti.continent=country.continent
  5. or write your own query

if you have any question, problem, suggestion or comment send email

download the script query2tree.zip

all you have to do is

edit the php file in order to have a working connection

You can modify the code in order to use your favorite tree script (sometimes easy, mostly hard, sometimes impossible)

About the filter :you can enter many words separated by space

if the result is one row, there is no need for ordering and filtering

Somewhere in the code there is a 7, This is the number or rows per "page".You can change it.

www.000webhost.com